package com.beehoo.dcportal.dao.impl;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import com.beehoo.dcportal.common.base.BaseDao;
import com.beehoo.dcportal.common.base.BaseException;
import com.beehoo.dcportal.dao.ICommunityDao;
import com.beehoo.dcportal.model.CommunityBean;

public class CommunityDaoImpl extends BaseDao implements ICommunityDao {
	
	private static final Logger logger = Logger.getLogger(CommunityDaoImpl.class);

	@SuppressWarnings("unchecked")
	@Override
	public List<CommunityBean> getcommunityList(String streetId)
			throws BaseException {
		List<CommunityBean> communityList = new ArrayList<CommunityBean>();
		
		try {
			communityList = (List<CommunityBean>)sqlMapClient.queryForList("portal-community.getCommunityList", streetId);
			
			logger.info("社区列表-获取社区列表|#调用portal-community.getCommunityList " +
					"中心编号："+streetId+",成功!");
		} catch (SQLException e) {
			logger.error("社区列表-获取社区列表|#调用portal-community.getCommunityList " +
					"中心编号："+streetId+",失败!", e);
			throw new BaseException(e, "获取社区列表失败");
		}
		
		return communityList;
	}
}
